<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>练习盒子</title>
</head>
<style>
    .outer{
        width: 100px;
        height: 100px;
        box-sizing: border-box;
        background-color: antiquewhite;
        float: left;
    }
    /* 水平垂直居中 */
    .div1{
        width: 200px;
        height: 200px;
        background: green;
        position:absolute;
        left:50%;    /* 定位父级的50% */
        top:50%;
        transform: translate(-50%,-50%); /*2D移动，自己的50% */
    }     
    .parent{
        width: 100px;
        height: 100px;
        display: table-cell;
        text-align: center;
        background-color: aqua;
        vertical-align: middle;
    }  
    .child{
        display: inline-block;
    }  
    .flex-box{
        display: flex;
        width: 100px;
        height: 100px;
        justify-content: center;
        align-items: center;
        background-color: aquamarine;
    }   
</style>
<body>
    <div class="outer">
        <div></div>
    </div>
    <div class="div1">

    </div>
    <div class="parent">
        <div class="child">2123</div>
    </div>
    <div class="flex-box">
        <div>123</div>
    </div>
</body>
</html>